#ifndef QTMETHOD_H
#define QTMETHOD_H

#include <QtGui>
#include <QtCore>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/tinyxml/tinystr.h>
#include <boost/tinyxml/tinyxml.h>

#endif

class QtMethod
{

public:
	// codec
	static void setCodec(char *);

	// QIcon
	static QIcon getFileIcon(QString path = "",bool isDir = true);

	// show user
	static void showError(QWidget *self,QString msg);
	static bool showChoose(QWidget *self,QString msg);

	// FileSystem
	static QString openSelectFolder(QWidget *self);
	static QString openSelectFile(QWidget *self,const QString ext);
	static QString saveFilePath(QWidget *self,QString ext);

	// QString and std::string
	static std::string QString2string(QString Qstr);
	static QString string2QString(std::string str);

	// QComboBox
	static void addItemForCmb(QComboBox *cmb,QList<QVariant>itemlist);

	// QTreeView
	static void clearTreeView(QStandardItemModel *&model);

	// xml && QStandarItem

	static QStandardItem *index2item(QModelIndex index);
	static QStandardItemModel *QtMethod::xml2model(QString xmlpath,bool include_root = true);
	static TiXmlDocument *model2xml(QModelIndex *index);
	static void traverseXml(TiXmlNode *root_node,QStandardItem *root_item);
	static QStandardItem *add_StandardItem(TiXmlNode *xml_node,QStandardItem *item_root);


private:

};
